using System.Linq;
using System.Xml.Linq;
using TickSharp.Core.Infrastructure.Serializers;
using TickSharp.Core.Interfaces;
using TickSharp.Core.Model;
using TickSharp.Tests.Properties;
using Xunit;

namespace TickSharp.Tests.IntegrationTests.Infrastructure
{
    public class UserSerializerTester
    {
        [Fact]
        public void CanParseApiSampleUser()
        {
            ISerializer<User> serializer = new UserSerializer();

            var userXml = XElement.Parse(SampleData.UserXml);
            var result = serializer.Deserialize(userXml).ToList();

            Assert.Equal(1, result.Count);

            User user = result.First();

            Assert.Equal(2, user.Id);
            Assert.Equal("James", user.FirstName);
            Assert.Equal("Kirk", user.LastName);
            Assert.Equal("james@idiggreenchicks.com", user.Email);
        }
    }
}